'use strict';
module.exports = app => {
  const { STRING, INTEGER, TEXT,DECIMAL } = app.Sequelize;
    const Model =  app.model.define(
      'orderGoodsDetail',
      {
          id: {type: INTEGER, primaryKey: true, autoIncrement: true},
          order_id: INTEGER(11),
          goods_id: INTEGER(11),
          count: INTEGER(11),
          status: INTEGER(11),
      },
      {
          tableName: 'order_goods_detail',
          timestamps: true, // 启用时间戳(createdAt, updatedAt)
          updatedAt: 'updated_time', // 不想要 updatedAt
          createdAt: 'create_time', // 想要  createdAt 但是希望名称叫做 created_at
      }
  );
    Model.associate = function () {
        Model.belongsTo(app.model.Goods, { foreignKey: 'goods_id', targetKey: 'id'}) // 订单详情与商品的关系定义
        Model.belongsTo(app.model.OrderGoods, { foreignKey: 'order_id', targetKey: 'id'}) // 订单详情与商品的关系定义
    }

    return Model
};



